#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
剪映草稿自动化服务 - 简化启动脚本
"""

import sys
import os

try:
    from draft_automation_service import DraftAutomationService
except ImportError as e:
    print(f"导入错误: {e}")
    print("请确保在正确的目录下运行此脚本")
    sys.exit(1)


def main():
    """主函数"""
    print("=" * 60)
    print("剪映草稿自动化服务")
    print("=" * 60)
    print("API接口:")
    print("  POST /api/process-draft      - 完整处理流程")
    print("  POST /api/start-task         - 启动异步任务")
    print("  GET  /api/task-status/<id>   - 获取任务状态")
    print("  GET  /api/health             - 健康检查")
    print("=" * 60)
    print("服务地址: http://localhost:5000")
    print("按 Ctrl+C 停止服务")
    print("=" * 60)

    try:
        service = DraftAutomationService()
        service.run(host='0.0.0.0', port=5000, debug=False)
    except KeyboardInterrupt:
        print("\n服务已停止")
    except Exception as e:
        print(f"启动失败: {e}")
        input("按回车键退出...")


if __name__ == '__main__':
    main()